﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX.Direct3D;

namespace KGE.Resource
{
    public class Textures
    {
        List<Texture> items = new List<Texture>();
        List<string> names = new List<string>();
        public int GetIndex(string name)
        {
            int i = 0;
            foreach (string str in names)
            {
                if (name.ToLower() == str.ToLower())
                {
                    return i;
                }
                i++;
            }
            return -1;
        }
        public void Add(string name, Texture texture)
        {
            names.Add(name);
            items.Add(texture);
        }
        public void Del(string name)
        {
            int i = GetIndex(name);
            names.RemoveAt(i);
            items.RemoveAt(i);
        }
        public void Del(int index)
        {
            names.RemoveAt(index);
            items.RemoveAt(index);
        }
        public int Count
        {
            get
            {
                return names.Count;
            }
        }
        public Texture this[int index]
        {
            get
            {
                return items[index];
            }
        }
        public Texture this[string name]
        {
            get
            {
                int i = GetIndex(name);
                return items[i];
            }
        }
    }
}
